package cn.zn.flowTemplate.enums;

public enum FlowStatusEnum {

    /**
     * 未知
     */
    UNKNOWN("-2", "未知"),

    /**
     * 暂存
     */
    TEMPORARY_STORAGE("-1", "暂存"),

    /**
     * 待审批
     */
    PENDING_APPROVAL("0", "待审批"),

    /**
     * 审批中
     */
    APPROVING("1", "审批中"),

    /**
     * 审核通过
     */
    APPROVED("2", "审核通过"),

    /**
     * 审核不通过
     */
    NOT_APPROVED("3", "审核不通过"),

    /**
     * 退回
     */
    ROLLBACK("4", "退回");

    private final String value;
    private final String name;

    FlowStatusEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static FlowStatusEnum parse(String value) {
        FlowStatusEnum[] enums = values();

        for (FlowStatusEnum statusEnum : enums) {
            if (statusEnum.getValue().equals(value)) {
                return statusEnum;
            }
        }
        return UNKNOWN;
    }

}
